import request from '@/router/axios'
import store from '@/store'
import {getMappingStatus, getMappingStatusArray, numToTwoPoint, getLineName,getStationName,} from "../../commonCheck";
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  align: 'center',
  selection: true,
  emptyBtn:false,
  reserveSelection:false,
  addBtn: false,
  column: [
  // {
  //   fixed: true,
  //   label: '主键',
  //   prop: 'id',
  //   span: 24,
  //   hide: true
  // }, 
  {
    width: 100,
    hide: false,
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    search: true,
    filterable : true,
    cascaderItem: ["stationCode"],
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getLineLists?userCode="+ store.getters.userInfo.userCode,
    display: true, // 动态显隐控制不能删除
    formatter: function (row, value, label, column) {
      return getLineName(value);
    }
  }, {
    width: 180,
    hide: false,
    label: '站点',
    prop: 'stationCode',
    type: 'select',
    search: true,
    filterable : true,
    dicFlag: false,
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getStationLists?userCode="+ store.getters.userInfo.userCode + "&lineCode={{key}}",
    display: true,// 动态显隐控制不能删除
    formatter: function (row, value, label, column) {
      return getStationName(row.lineCode, value);
    }
  },{
    label: '日期',
    prop: 'opertorTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    type: 'date',
    hide: false,
    search: false
  },{
    width: 120,
    label: '售票员',
    prop: 'conductorName',
    search: false,
  }
  // ,{
  //   hide: false,
  //   label: '售票员',
  //   prop: 'conductorId',
  //   search: true,
  //   searchslot : true
  // }
  ,{
    width: 100,
    label: '设备操作号',
    prop: 'deviceOperateNum',
    hide: false,
    search: false
  },{
    width: 130,
    label: 'BOM编号',
    prop: 'bomCode',
    hide: false,
    search: false
  },{
    width: 120,
    label: '合计售出张数',
    prop: 'totalSellNum',
    search: false,
    hide: false,
  }, {
    width: 120,
    hide: false,
    label: '合计售卖金额',
    formatter:function(row, value , label, column){
      return numToTwoPoint(value);
    },
    prop: 'totalSellAmount',
    search: false
  }, {
      hide: false,
      label: '审批状态',
      dicData:getMappingStatusArray("StMarketingTicket_aduitStatus"),
      formatter:function(row, value , label, column){
        if(!value){
          return '待审核';
        }
        return getMappingStatus("StMarketingTicket_aduitStatus",value);
      },
      prop: 'auditStatus',
      type:'select',
      search: true
    },{
      label: '操作状态',
      prop: 'executeStatus',
      type: 'select',
      dicData: [
        {
          label: '未操作',
          value: '0'
        }, {
          label: '已操作',
          value: '1'
        }
      ],
      formatter:function(row, value , label, column){
        return value == 1?'已操作':'未操作';
      },
      search: true,
      hide: false,
     },{
      width: 160,
      hide: false,
      label: '是否加入报表差错',
      prop: 'isAddReprotError',
      type:'select',
      //search: true,
      dicData: [{
        label: '是',
        value: '1'
      },{
        label: '否',
        value: '0'
      }],
      formatter:function(row, value , label, column){
        return value == 0?'否':'是';
      }
    }]
}
export function getSwStMarketingTicket(param) {
  return request({
    url: '/check/check/getSwStMarketingTicket',
    method: 'post',
    params: param
  })
}

/**
 * 批量审核
 * @param param
 */
export function batchAduitSwStMarketingTicket(param) {
  return request({
    url: '/check/check/batchAduitSwStMarketingTicket',
    method: 'post',
    params: param
  })
}

export function getSysUserToLine(param) {
  return request({
    url: '/check/check/getSysUserToLine',
    method: 'post',
    params: param
  })
}

/**
 * 营销车票数据审核点击生成电子回执单“对账数据”
 * @param {*} obj
 */
export function createFares(obj) {
  return request({
    url: '/check/check/getElectronicReceipt',
    method: 'get',
    params: obj
  })
}

